<template>
    <el-card>
        <div slot="header" class="clearfix">
            <span style="line-height: 36px;">{{type}}急救中心</span>
            <el-button type="primary" style="float:right" @click="submint">
                提交
            </el-button>
        </div>
        <el-form :inline="true" :model="form" class="demo-form-inline">
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="名称" label-width="100px">
                        <el-input v-model="form.SAMU_NAME"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="所属地区" label-width="100px">
                       <el-input v-model="form.SAMU_ADDRESS"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row :gutter="20">
                  <el-col :span="12">
                    <el-form-item label="电话" label-width="100px">
                        <el-input v-model="form.SAMU_TEL"></el-input>
                    </el-form-item>
                </el-col>
                 <el-col :span="12">
                    <el-form-item label="详细地址" label-width="100px">
                       <el-input v-model="form.SAMU_ADDRESSDETAIL"></el-input>
                    </el-form-item>
                </el-col>
              

               
            </el-row>
            <el-row :gutter="20">
                <el-col :span="12">
                    <el-form-item label="建立时间" label-width="100px">
                        <el-input v-model="form.SAMU_BEGINTEIM"></el-input>
                    </el-form-item>
                </el-col>
             <el-col :span="12">
                    <el-form-item label="工作时间" label-width="100px">
                       <el-input v-model="form.SAMU_WORKTIME"></el-input>
                    </el-form-item>
                </el-col>
                
            </el-row>
            <el-row :gutter="20">
                <el-col :span='12'>
                    <el-form-item label="网址" label-width="100px">
                        <el-input v-model="form.SAMU_WEB"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="支付方式" label-width="100px">
                         <el-input v-model="form.SAMU_PAYTYPE"></el-input>                       
                    </el-form-item>
                </el-col>
            </el-row>   
        </el-form>
    </el-card>
</template>

<script>
import api from "@/js/api";
import getid from "@/js/getid";
export default {
  data() {
    return {
      name: "",
      form: {
        SAMU_ID: '',
        SAMU_NAME: '',
        SAMU_ADDRESS: '',
        SAMU_TEL: '',
        SAMU_WORKTIME: '',
        SAMU_BEGINTEIM: '',
        SAMU_WEB: '',
        SAMU_PAYTYPE: '',
        SAMU_ADDRESSDETAIL: ''
      }
    };
  },
  props: {
    type: {
      type: String,
      default: ""
    },
    Id: {
      type: String,
      default: ""
    }
  },
  methods: {
    submint() {
      if (this.type == "新增") {
        this.form.SAMU_ID = getid.getid();
        api.SAMUAdd(this, this.form);
      } else {
            api.SAMUUpdate(this, this.form);
      }
    }
  },
  created() {
    if (this.type == "查看") {
      let that = this;
      api.SAMUGetOne(that, { Id: that.Id }, function(msg) {
        that.form = msg.Result;
      });
    }
  }
};
</script>

<style>

</style>
